<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>



<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.08">
<LINK rel="stylesheet" type="text/css" href="libman.css">
<TITLE>
Debugging CHR Programs
</TITLE>
</HEAD>
<BODY >
<A HREF="libman049.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="libman042.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="libman051.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H2 CLASS="section"><A NAME="htoc95">8.8</A>&nbsp;&nbsp;Debugging <FONT COLOR=purple>CHR</FONT> Programs</H2><UL>
<LI><A HREF="libman050.html#toc47">Using the Debugger</A>
</UL>

<A NAME="chrdebug"></A>
User-defined constraints including application of <FONT COLOR=purple>CHR</FONT>s can be traced
with the standard debugger. 
Debugging of the ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> code is done
in the standard way. See the corresponding user
manual for more information.<BR>
<BR>
<A NAME="toc47"></A>
<H3 CLASS="subsection"><A NAME="htoc96">8.8.1</A>&nbsp;&nbsp;Using the Debugger</H3>
In order to use the debugging tool, the <CODE>debug_compile</CODE> flag<A NAME="@default270"></A><A NAME="@default271"></A><A NAME="@default272"></A>
must have been <CODE>on</CODE> (default) during compilation (<CODE>chr</CODE> to
<CODE>pl</CODE>) and loading of the produced ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> code.
<UL CLASS="itemize"><LI CLASS="li-itemize">
The query <CODE>trace.</CODE> activates the standard debugger
(tracing user-defined constraints like predicates).
<LI CLASS="li-itemize">The query <CODE>chr_trace.</CODE> activates the standard debugger
showing more information about the handling of constraints.
(application of <FONT COLOR=purple>CHR</FONT>s).
<LI CLASS="li-itemize">The query <CODE>chr_notrace.</CODE> stops either debugger.
</UL>
The debugger displays user-defined constraints and application of
<FONT COLOR=purple>CHR</FONT>s. User-defined constraints are
treated as predicates and the information about application of <FONT COLOR=purple>CHR</FONT>s
is displayed without stopping. See the
subsection on how <FONT COLOR=purple>CHR</FONT>s work for an example trace. The additional
ports are:
<UL CLASS="itemize"><LI CLASS="li-itemize">
 <CODE>add</CODE>: A new constraint is added to the constraint store.<BR>
<BR>
<LI CLASS="li-itemize"><CODE>already_in</CODE>: A constraint to be added was already present.
</UL>
The ports related to application of rules are:
<UL CLASS="itemize"><LI CLASS="li-itemize">
 <CODE>try_rule</CODE>: A rule is tried.<BR>
<BR>
<LI CLASS="li-itemize"><CODE>delay_rule</CODE>: The last tried rule cannot fire because the guard did not succeed.<BR>
<BR>
<LI CLASS="li-itemize"><CODE>fire_rule</CODE>: The last tried rule fires.
</UL>
The ports related to labeling are:
<UL CLASS="itemize"><LI CLASS="li-itemize">
 <CODE>try_label</CODE>: A label_with declaration is checked.<BR>
<BR>
<LI CLASS="li-itemize"><CODE>delay_label</CODE>: The last label_with declaration delays because the guard did not succeed.<BR>
<BR>
<LI CLASS="li-itemize"><CODE>fire_label</CODE>: The last tried label_with declaration succeeds,
so the clauses of the associated constraint will be used for built-in labeling.</UL>

When displayed, each constraint
is labelled with a unique integer identifier. Each rule is labelled
with its name as given in the <TT>chr</TT> source using the <CODE>@</CODE>
operator. If a rule does not have a name, it is displayed together
with a unique integer identifier.<BR>
<BR>
<HR>
<A HREF="libman049.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="libman042.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="libman051.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
